package com.idheima.zuoye.zuoye6;

import com.idheima.zuoye.zuoye4.Animal;

public class Tesyt {
    public static void main(String[] args) {
        feed(new Animal("小黄") {
            @Override
            public void eat() {
                System.out.println(getName()+"啃骨头");
            }
        });
        feed(new Animal("小花") {
            @Override
            public void eat() {
                System.out.println(getName()+"吃鱼");
            }
        });
        feed(new Animal("小黑") {
            @Override
            public void eat() {
                System.out.println(getName()+"吃猪饲料");
            }
        });
    }
 public static void feed(Animal animal)
 {
     animal.eat();
 }

}

